Skip to content

Conversation

@rautenrieth-da
Copy link
Contributor

Attempt to speed up deleting acs snapshots by:

  • Not running multiple transactional delete queries in parallel
  • Merging multiple delete queries into one

[ci]

Signed-off-by: Robert Autenrieth <robert.autenrieth@digitalasset.com>
Copy link
Contributor

@OriolMunoz-da OriolMunoz-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the other PR already will fix the issue (seq scan over u_h_c) - but the changes in this PR are still good, thanks!

@rautenrieth-da
Copy link
Contributor Author

I think the #1069 already will fix the issue

We still need to speed up deleteAcsSnapshotsAfter. Store initialization is taking too long on CILR, which is blocking app startup:

INFO 2025-06-06T08:36:04.192453755Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] This update history may be missing import updates, checking for corrupt ACS snapshots
INFO 2025-06-06T08:36:04.311723121Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleting ACS snapshots for history 1 with migration 1 and recordTime > 0001-01-01T00:00:00Z
INFO 2025-06-06T08:36:04.315337937Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleting ACS snapshots for history 1 with migration 2 and recordTime > 0001-01-01T00:00:00Z
INFO 2025-06-06T08:36:04.316469990Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleting ACS snapshots for history 1 with migration 3 and recordTime > 0001-01-01T00:00:00Z
INFO 2025-06-06T08:36:04.363233696Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleted 120 rows from acs_snapshot, expecting to delete 27189522 rows from acs_snapshot_data
INFO 2025-06-06T08:36:04.363955058Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleted 184 rows from acs_snapshot, expecting to delete 2331225 rows from acs_snapshot_data
INFO 2025-06-06T08:36:04.388617987Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleted 718 rows from acs_snapshot, expecting to delete 51890215 rows from acs_snapshot_data
INFO 2025-06-06T09:22:25.334215633Z [resource.labels.namespaceName: sv-6] [resource.labels.containerName: scan-app] Deleted 2331225 rows from acs_snapshot_data

The following simple test on a copy of CILR is still taking >1h to complete, so unfortunately selective removal of snapshots is not an option, we'll have to truncate both acs tables.

begin;
select min(first_row_id), max(last_row_id) from scan_sv_1.acs_snapshot where migration_id = 2;
delete from scan_sv_1.acs_snapshot where migration_id = 2;
delete from scan_sv_1.acs_snapshot_data where row_id >= 83470207 and row_id <= 113431985;
commit;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants